@ max . s
@ find the maximum from a list of numbers.
@ nicked & refactored for ARM from "Programming from the Ground Up.

@ rl - Used to hold address of data items
@ rO - used for the largest item
@ r3 - used for current data item

section                    .data

numbers:                   @ the data we are goin
.long                   3,67,34,222,45,75,54,34,44,33,22,11,66,0

.globl _start

_start:
Idr %rl, =numbers           @ set rl to start address of "numbers"
Idr %r3, [%rl]              @ load r3 with first number
mov %rO, %r3                @ Ot Start the current number must be the largest.

loop:
cmp   %r3,
beq
Idr
cmp
bl e
mov
bal


exit
%r3,
%r3,
loop
%rO,
loop

$0

[%rl,#4]!
%rO

%r3

@
@
@
@
@
@
@

check if r3 holds zero(end of list)
if so, exit
load next item into r3
compare ro and r3
goto start of loop if r3 <= ro
otherwise put r3 into ro
goto start of loop(Branch ALways)

exit:
mov %r7, $1
svc $0
.end

@ largest value is now in rO
@ prepare to exit
@ wake kernel

@ marks the end of the code
